Skip to main content

All Questions

0votes
2answers
391views

Coffee machine strategy pattern implementation

I came across an article about LSP https://stackify.com/solid-design-liskov-substitution-principle/ . It seems that a strategy pattern could be implemented here but I cannot see how to implement it. ...
Gullit's user avatar
2votes
1answer
233views

How to implement Gang of Four's Lexi's Compositor-Composition?

I'm studying Design Patterns book and I was trying to understand the Composition principle in Lexi's Compositor-Composition as explained in figure 2.5, as well as how to implement it. Where the ...
Christian H's user avatar
3votes
2answers
5kviews

Implementing strategy pattern multiple variables?

I am trying to implement Strategy Pattern for handling my content serialization and deserialization. So I have four kind of requests namely CREATE, RETRIEVE, UPDATE, DELETE and for each request I want ...
Siddharth Trikha's user avatar
2votes
1answer
242views

Injection, strategies and OO

I'm working on refactoring a project. The business logic looks very much like using the Strategy pattern would be very beneficial, because depending on the values of three properties (let's say age, ...
user3748908's user avatar
0votes
1answer
442views

How to organize conversion logic for strategy pattern?

I have a Color class. It has a property model which is a class that implements ColorModel interface, this property could be a RGB, Hex or HSL classes which implementing ColorModel interface. // ...
volter9's user avatar
3votes
2answers
597views

What do I gain by using the Strategy pattern in this case?

I wrote a program with Java that plays simple music. Currently chords have only one way ('strumming pattern') to be played. I want to expand this and create different 'strumming patterns' that chords ...
Aviv Cohn's user avatar
0votes
1answer
1kviews

MVC: Where should I store interchangeable algorithms used by the Model (whose names also need to be accessible to the View)?

Please consider a program, where the user chooses an algorithm from a list, and the Strategy pattern is utilized to set this algorithm as the model's operation. For example, an image procession ...
Aviv Cohn's user avatar
1vote
2answers
2kviews

Implementing a strategy pattern with dependency injection

Okay, so the goal here is to implement a strategy pattern that can be tested using any sort of automated testing tool. I've been struggling with this problem conceptually for a few weeks now and I ...
Carvefx's user avatar
1vote
1answer
1kviews

would a composite design pattern be useful for group membership?

I'm trying to think about the best way to handle group memberships on a website. People sign up and select checkboxes in a list of interests. Every week we send out interest-themed emails to those ...
changokun's user avatar
4votes
3answers
1kviews

Can you point me to a nontrivial strategy pattern implementation? [closed]

We are faced implementing a registration workflow with many branches. There are three main flows which in some conditions lead to one another. Each flow has at least four different steps; some steps ...
Eugen Martynov's user avatar
4votes
4answers
4kviews

Can the strategy pattern be overused?

Example: A file, representing a serialized version of an object, needs to be read and deserialized. It would simple to implement this if we only cared about a single serialization format, but many ...
ubtng's user avatar

close